<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${basePath}"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<link href="css/tableThinLine2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">


jQuery(function($){
	
});

var orgTrContent = null;
var trIdEdit = null;
function edit(obj){
	if(trIdEdit != null){
		cancel();
	} 
	var trObj = $(obj).parent().parent();
	//得到行ID
	trIdEdit = trObj.attr("id");
	orgTrContent = trObj.html();
	
	var tds = trObj.children();
	var td1 = tds.eq(0);
	var td2 = tds.eq(1);
	var td3 = tds.eq(2);

	var htmlStr = "<td></td><td colspan=\"4\" height=\"20\">"
		+"<form action=\"selection/selection_updateSubmit.htm\" method=\"post\" style=\"margin:0\">"
		+"<table bordercolor=\"#FF0000\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\"  width=\"100%\">"
		+"<tr>"
		+"<td style=\"width: 200px;\"><input type=\"hidden\" name=\"id\" value='"+td1.children().attr("value")+"'/><input name=\"name\" value='"+$.trim(td2.html())+"' style=\"width: 200px;border:0;\"/></td>"
		+"<td style=\"width: 120px;\"><input name=\"lang\" value='"+$.trim(td3.html())+"' style=\"width: 120px;border:0;\"/></td>"
		+"<td style=\"width: 50px;\"><input name=\"ordernum\" value='"+$.trim(td3.html())+"' style=\"width: 50px;border:0;\"/></td>"
		+"<td>&nbsp;<input type=\"submit\" value=\"保存修改 \" style=\"width: 60px;\"/>&nbsp;<input type=\"button\" onclick='javascript:cancel();' value=\"取消 \"/></td>"
		+"</tr>"
		+"</table></form>"
		+"</td>";  

	//alert(htmlStr);
	trObj.html(htmlStr);
}
function cancel(){
	var trObj = $("#"+trIdEdit+"");
	trObj.html(orgTrContent);
}
</script>
<title>Insert title here</title>
</head>
<body>
属性管理
<hr class="hr0" />
<table>
	<tr>
		<td>
			<table class="tabClass">
	<tr><td colspan="4" align="center"><strong></strong></td></tr>
	<tr><td style="width: 20px;"></td><td style="width: 200px;">名称</td><td style="width: 120px;">语言</td><td style="width: 50px;">排序</td><td style="width: 120px;">操作</td></tr>
	<c:forEach items="${selectionList}" var="se" >
		<tr id="tr_${se.id}" class="pBg">
			<td>
			<input type="hidden" name="id" value="${se.id}"/>
			</td>
			<td>
				${se.name}
			</td>
			<td>${se.lang}</td>
			<td>${se.ordernum}</td>
			<td>
			<a href="javascript:void(0);" onclick="javascript:edit(this);">编辑</a> / 
			<a href="selection/selection_del.htm?id=${se.id}">删除</a> / 
			</td>
		</tr>
		<c:forEach items="${se.subselection}" var="subSe">
			<tr id="tr_${subSe.id}">
				<td>
				<input type="hidden" name="id" value="${subSe.id}"/>
				</td>
				<td>
					${subSe.name}
				</td>
				<td>${subSe.lang}</td>
				<td>${subSe.ordernum}</td>
				<td>
				<a href="javascript:void(0);" onclick="javascript:edit(this);">编辑</a> / 
				<a href="selection/selection_del.htm?id=${subSe.id}">删除</a> / 
				</td>
			</tr>
		</c:forEach>
	</c:forEach>
</table>
		</td>
		
		<td valign="top">
		添加属性
		<form action="selection/selection_addSubmit.htm" method="post" style="margin:0">
		<table class="tabClass">
			<tr><td>名称</td><td>语言</td><td style="width: 30px;">排序</td></tr>
			<tr>
				<td><input name="name" /><input type="hidden" name="cataid" value="0"/></td>
				<td><select name="lang"><option value="1">中文</option><option value="2">英文</option></select></td>
				<td><input name="ordernum" style="width: 30px;"/></td>
			</tr>
		</table>
		<table><tr><td align="center"><input type="submit" value=" 添  加  "/></td></tr></table>
		</form>
		
		<br/>
		二级属性
		<form action="selection/selection_addSubmit.htm" method="post" style="margin:0">
		<table class="tabClass">
			<tr><td style="width: 129px;">从属上级</td><td>名称</td><td>语言</td><td>排序</td></tr>
			<tr>
			<td style="width: 129px;">
				<select name="cataid" style="width: 129px;">
					<c:forEach items="${selectionList}" var="se" >
						<option value="${se.id}">${se.name}</option>
					</c:forEach>
				</select>
			</td>
			<td><input name="name"/></td>
			<td><select name="lang"><option value="1">中文</option><option value="2">英文</option></select></td>
			<td><input name="ordernum" style="width: 30px;"/></td>
			</tr>
		</table>
		<table><tr><td align="center"><input type="submit" value=" 添  加  "/></td></tr></table>
		</form>
		</td>
	</tr>
</table>



			
</body>
</html>